package org.goldenport.g3

import scala.collection.Map

/**
 * @since   Mar. 19, 2010
 * @version Oct. 12, 2010
 * @author  ASAMI, Tomoharu
 */
class G3Parcel(
  val id: G3ParcelId,
  val title: String,
  val author: G3ChannelId,
  val published: Long, // nsec
  val updated: Long,   // nsec
  //
  val destinations: List[G3ChannelId],
  //
  val sources: List[G3ParcelId],
  val parent: Option[G3ParcelId], // parents: List[G3ParcelId]
  val base: Option[G3ParcelId],
  val children: List[G3ParcelId],
  val sequenceNo: Int,
  //
  val session: Option[G3Session],
  val job: Option[G3JobId],
  val transaction: Option[G3TransactionId],
  val unitofwork: Option[G3UnitofworkId],
  //
  val content: AnyRef, // G3Message or Raw data
  val attachments: List[AnyRef],
  val properties: Map[String, AnyRef],
  //
  val tickets: List[G3Ticket],
  val context: G3Context
) extends NotNull {
  override def equals(o: Any): Boolean = {
    o match {
      case parcel: G3Parcel => parcel.id == id
      case _ => false
    }
  }

  override def hashCode(): Int = {
    id.hashCode
  }

  override def toString() = {
    """%s[%s][%s] %s""".format(title, id.nickname, updated, content)
  }

  def toXml() = {
  }

  def toXmlString() = {
  }
}
